package com.woniu.controller.operation;

import com.woniu.controller.BaseController;
import com.woniu.entity.Result;
import com.woniu.pojo.Order;
import com.woniu.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pay")
@Api(tags = "订单支付")
public class PayController extends BaseController {
    @Autowired
    private IOrderService orderService;

    @GetMapping("/{id}")
    @ApiOperation("支付成功")
    public Result pay(@PathVariable Long id) {
        Order order = orderService.getById(id);
        order.setStatus("2");
        return toResult(orderService.updateById(order));
    }

}
